import { director } from 'cc';
import { _decorator, Component, Node } from 'cc';
import { EVENT_NAMES } from '../../../utils/Enums';
import { MonoUIPanel } from '../../../../project-base/src/scripts/MonoUIPanel';
import DataMgr from '../../../utils/DataMgr';
import { UIManager } from '../../../framework/ui/uimanager/UIManager';
const { ccclass, property } = _decorator;

@ccclass('WinPanel')
export class WinPanel extends MonoUIPanel {
    start() {

    }
    
    // ----------------------- 事件 ----------------------- //
    private onBackToMain() {
        director.loadScene("start")
    }

    private onNextLevel() {
        DataMgr.currentLevel++
        gg.systemEvent.emit(EVENT_NAMES.ON_GAME_START)
        UIManager.close("win:res/prefab/WinPanel")
    }

    private async onClose() {
        await this.onExitAnimation();
        director.loadScene("start")
    }
}


